import http from '../../../util/http.js';

const  VehicleTypePrefix = "/basics/vehicle/type";  //车辆分类前缀


//车辆分类列表
export function vehicleTypeList(pagination, param) {
    let url = `${VehicleTypePrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//新增车辆分类
export function vehicleTypeAdd(data) {
    let url = `${VehicleTypePrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//修改车辆分类
export function vehicleTypeUpdate(id, data) {
    let url = `${VehicleTypePrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//删除车辆分类
export function VehicleTypeDelete(id) {
    let url = `${VehicleTypePrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}




 //============================计费规则分组==========================

const  FeeRulePrefix = "/basics/fee/rule";  //车辆分类前缀

export function FeeGroupList(pagination) {
    let url = `${FeeRulePrefix}/group/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });
}



export function FeeGroupAdd(data) {
    let url = `${FeeRulePrefix}/group/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

export function FeeGroupUpdate(id, data) {
    let url = `${FeeRulePrefix}/group/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//删除车辆分类
export function FeeGroupDelete(id) {
    let url = `${FeeRulePrefix}/group/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}



export function FeeRuleList(pagination,data) {
    let url = `${FeeRulePrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url,data).then(response => {
            resolve(response)
        });
    });
}


//提交时段规则测试
export function  FeeRuleDetection(data) {
    let url = `${FeeRulePrefix}/detection`;
    return new Promise((resolve, reject) => {
        http.post(url,data).then(response => {
            resolve(response)
        });
    });

}






//规则时间列表
export function TimePeriodList(ruleCode) {
    let url = `${FeeRulePrefix}/time/period/${ruleCode}`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });
}


//新增时段规则
export function TimePeriodAdd(data) {
    let url = `${FeeRulePrefix}/time/period/add`;
    return new Promise((resolve, reject) => {
        http.post(url,data).then(response => {
            resolve(response)
        });
    });
}



//修改时段规则
export function TimePeriodUpdate(id,data) {
    let url = `${FeeRulePrefix}/time/period/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url,data).then(response => {
            resolve(response)
        });
    });
}


//修改时段规则
export function TimePeriodDelete(id) {
    let url = `${FeeRulePrefix}/time/period/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}


//=========================================区域管理========================

const  AreaPrefix = "/basics/area";  //车辆分类前缀

//车辆分类列表
export function areaList(pagination, param) {
    let url = `${AreaPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//新增车辆分类
export function  areaAdd(data) {
    let url = `${AreaPrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//修改车辆分类
export function areaUpdate(id, data) {
    let url = `${AreaPrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//删除车辆分类
export function areaDelete(id) {
    let url = `${AreaPrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}







//=========================================街道管理========================

const  StreetPrefix = "/basics/street";

//街道管理列表
export function streetList(pagination, param) {
    let url = `${StreetPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//街道管理分类
export function  streetAdd(data) {
    let url = `${StreetPrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//街道管理分类
export function streetUpdate(id, data) {
    let url = `${StreetPrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//街道管理分类
export function streetDelete(id) {
    let url = `${StreetPrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}





//=========================================场地管理API========================

const  PlacePrefix = "/basics/place";  //车辆分类前缀

//车辆分类列表
export function placeList(pagination, param) {
    let url = `${PlacePrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//新增车辆分类
export function  placeAdd(data) {
    let url = `${PlacePrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//修改车辆分类
export function placeUpdate(id, data) {
    let url = `${PlacePrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//删除车辆分类
export function placeDelete(id) {
    let url = `${PlacePrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}




//=================车位管理Api========================

const  SeatPrefix = "/basics/seat";

export function seatList(pagination, param) {
    let url = `${SeatPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}


export function  seatAdd(data) {
    let url = `${SeatPrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}


export function seatUpdate(id, data) {
    let url = `${SeatPrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}


export function seatDelete(id) {
    let url = `${SeatPrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}




//===================================设备管理====================

const  DevicePrefix = "/basics/device";  //车辆分类前缀

//车辆分类列表
export function deviceList(pagination, param) {
    let url = `${DevicePrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//新增车辆分类
export function  deviceAdd(data) {
    let url = `${DevicePrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//修改车辆分类
export function deviceUpdate(id, data) {
    let url = `${DevicePrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}


export function deviceDelete(id) {
    let url = `${DevicePrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}

//刷新监听列表
export function deviceRefreshListen(){
    let url = `${DevicePrefix}/refresh/listen/list`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });

}




const  CashierPrefix = "/basics/cashier";  //车辆分类前缀


//收费员分类列表
export function cashierList(pagination, param) {
    let url = `${CashierPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

//新增收费员
export function cashierAdd(data) {
    let url = `${CashierPrefix}/add`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });
}

//修改收费员
export function cashierUpdate(id, data) {
    let url = `${CashierPrefix}/update/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}

//删除收费员
export function cashierDelete(id) {
    let url = `${CashierPrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}

